<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>rtcpsu: xrtcpsu_alarm_interrupt_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">rtcpsu
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xrtcpsu__alarm__interrupt__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xrtcpsu_alarm_interrupt_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains an alarm example using the <a class="el" href="struct_x_rtc_psu.html" title="The XRtcPsu driver instance data. ">XRtcPsu</a> driver in interrupt mode. </p>
<p>It sets alarm for a specified time from the current time.</p>
<dl class="section note"><dt>Note</dt><dd>The example contains an infinite loop such that if interrupts are not working it may hang.</dd></dl>
<p>MODIFICATION HISTORY: </p>
<pre>
Ver   Who    Date     Changes
</p>
<hr/>
<p>
1.00  kvn 05/12/15 First Release
      ms  04/10/17 Modified filename tag to include the file in doxygen
                   examples.
1.12  sne 04/25/22 Added volatile keyword for IsAlarmGen variable.
1.13  ht  06/22/23 Added support for system device-tree flow.
1.15  ht  12/13/24 Fix C++ compilation warnings and errors in SDT flow.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aca7489498f1a9a10779073aae78c335e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#aca7489498f1a9a10779073aae78c335e">RtcPsuAlarmIntrExample</a> (XScuGic *IntcInstPtr, <a class="el" href="struct_x_rtc_psu.html">XRtcPsu</a> *RtcInstPtr, u16 DeviceId, u16 RtcIntrId)</td></tr>
<tr class="memdesc:aca7489498f1a9a10779073aae78c335e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function does a minimal test on the Rtc device and driver as a design example.  <a href="#aca7489498f1a9a10779073aae78c335e">More...</a><br/></td></tr>
<tr class="separator:aca7489498f1a9a10779073aae78c335e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aec9a48698a06b521d36fbec8793119ec"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#aec9a48698a06b521d36fbec8793119ec">Handler</a> (void *CallBackRef, u32 Event)</td></tr>
<tr class="memdesc:aec9a48698a06b521d36fbec8793119ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing to handle interrupt events from the device.  <a href="#aec9a48698a06b521d36fbec8793119ec">More...</a><br/></td></tr>
<tr class="separator:aec9a48698a06b521d36fbec8793119ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to call the RTC Alarm interrupt example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="aec9a48698a06b521d36fbec8793119ec"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Handler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>Event</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing to handle interrupt events from the device. </p>
<p>It is called from an interrupt context. so the amount of processing should be minimal.</p>
<p>This handler provides an example of how to handle interrupt data for the device and is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>contains a callback reference from the driver, in this case it is the instance pointer for the <a class="el" href="struct_x_rtc_psu.html" title="The XRtcPsu driver instance data. ">XRtcPsu</a> driver. </td></tr>
    <tr><td class="paramname">Event</td><td>contains the specific kind of event that has occurred.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="group__rtcpsu.html#gad594fbf58a112754966cb4ed07a93fa2">XRTCPSU_EVENT_ALARM_GEN</a>.</p>

<p>Referenced by <a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#aca7489498f1a9a10779073aae78c335e">RtcPsuAlarmIntrExample()</a>, <a class="el" href="xrtcpsu__periodic__alarm__interrupt__example_8c.html#a0c2c2ab4797fdf2b3b74ea1779613740">RtcPsuPeriodicAlarmIntrExample()</a>, and <a class="el" href="xrtcpsu__seconds__interrupt__example_8c.html#aecfd61f6d79958df4da34ea62ab534f9">RtcPsuSecondsIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to call the RTC Alarm interrupt example. </p>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#aca7489498f1a9a10779073aae78c335e">RtcPsuAlarmIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="aca7489498f1a9a10779073aae78c335e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int RtcPsuAlarmIntrExample </td>
          <td>(</td>
          <td class="paramtype">XScuGic *&#160;</td>
          <td class="paramname"><em>IntcInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_x_rtc_psu.html">XRtcPsu</a> *&#160;</td>
          <td class="paramname"><em>RtcInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>DeviceId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>RtcIntrId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function does a minimal test on the Rtc device and driver as a design example. </p>
<p>The purpose of this function is to illustrate how to use alarm feature in the <a class="el" href="struct_x_rtc_psu.html" title="The XRtcPsu driver instance data. ">XRtcPsu</a> driver.</p>
<p>This function sets alarm for a specified time from the current time.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstPtr</td><td>is a pointer to the instance of the ScuGic driver. </td></tr>
    <tr><td class="paramname">RtcInstPtr</td><td>is a pointer to the instance of the RTC driver which is going to be connected to the interrupt controller. </td></tr>
    <tr><td class="paramname">DeviceId</td><td>is the device Id of the RTC device and is typically XPAR_&lt;RTCPSU_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">RtcIntrId</td><td>is the interrupt Id and is typically XPAR_&lt;RTCPSU_instance&gt;_INTR value from xparameters.h.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This function contains an infinite loop such that if interrupts are not working it may never return. </p>

<p>References <a class="el" href="struct_x_rtc_psu___config.html#a0bc4fef50a1edc589aaa4f9fed0a50c2">XRtcPsu_Config::BaseAddr</a>, <a class="el" href="struct_x_rtc_psu___d_t.html#a0d91fe193b2ace3bec1c253d9d4651b0">XRtcPsu_DT::Day</a>, <a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#aec9a48698a06b521d36fbec8793119ec">Handler()</a>, <a class="el" href="struct_x_rtc_psu___d_t.html#a5217abcfa19b6ee79441c80593233410">XRtcPsu_DT::Hour</a>, <a class="el" href="struct_x_rtc_psu___d_t.html#a985ad2e22c16c13787bad0bc5a6252d3">XRtcPsu_DT::Min</a>, <a class="el" href="struct_x_rtc_psu___d_t.html#a17e3941ee44e1c60d8702e5ea9a6b658">XRtcPsu_DT::Month</a>, <a class="el" href="struct_x_rtc_psu___d_t.html#a2a4a6d1fc2f482c69610be4c46681ee0">XRtcPsu_DT::Sec</a>, <a class="el" href="struct_x_rtc_psu___d_t.html#a768d292f62468b17e36dce098f8c7d49">XRtcPsu_DT::WeekDay</a>, <a class="el" href="group__rtcpsu.html#ga04fcc0a1ae6b27f2a3e0f1ba723c48e3">XRtcPsu_CfgInitialize()</a>, <a class="el" href="group__rtcpsu.html#gaefced00316539320411829b4d701fe3c">XRtcPsu_ClearInterruptMask()</a>, <a class="el" href="group__rtcpsu.html#gad47ac1cadbbe8dd0e67588d1fc658cc2">XRtcPsu_GetCurrentTime()</a>, <a class="el" href="group__rtcpsu.html#ga01ca03d23194687c8026dc2f38da6ff7">XRtcPsu_InterruptHandler()</a>, <a class="el" href="group__rtcpsu.html#ga665fbe64a08c5b13b838ab7b69188e3e">XRtcPsu_LookupConfig()</a>, <a class="el" href="group__rtcpsu.html#gaac3d95ea1a75533a1fd3cd95d62a9914">XRtcPsu_SecToDateTime()</a>, <a class="el" href="group__rtcpsu.html#ga1c969c089715ea9a86cec887c09f9b92">XRtcPsu_SelfTest()</a>, <a class="el" href="group__rtcpsu.html#ga201537801ac896c73018a8719e8637d8">XRtcPsu_SetAlarm()</a>, <a class="el" href="group__rtcpsu.html#ga40b45bedf590e3e65eb525f1827768e4">XRtcPsu_SetHandler()</a>, <a class="el" href="group__rtcpsu.html#ga645920d3519722e8dc815d07db527367">XRtcPsu_SetInterruptMask()</a>, and <a class="el" href="struct_x_rtc_psu___d_t.html#a422474627fadc62823e8ff87e0bf1863">XRtcPsu_DT::Year</a>.</p>

<p>Referenced by <a class="el" href="xrtcpsu__alarm__interrupt__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
